//
//  FontManager.m
//  LingQian
//
//  Created by xieyingze on 2018/1/21.
//  Copyright © 2018年 xieyingze. All rights reserved.
//

#import "FontManager.h"

@implementation FontManager

+ (instancetype)shareInstance {
    static dispatch_once_t once;
    static id _instance;
    dispatch_once(&once, ^{
        _instance = [[self alloc] init];
    });
    return  _instance;
}

#pragma mark - Interface


#pragma mark - Setter

- (void)setFontStyle:(kFontStyle)fontStyle {
    _fontStyle = fontStyle;
}

- (void)setFontColorStyle:(kFontColorStyle)fontColorStyle {
    switch (fontColorStyle) {
        case kFontColorStyleRed:{
            //self.mainFontColor =  KCOLOR(250,89,41);
            self.mainFontColor = kCOLOR_RGBValue(0x333333);
        }
            break;
        case kFontColorStyleOrange:{
            //self.mainFontColor = kCOLOR_RGBValue(0xfc9154);
            self.mainFontColor = kCOLOR_RGBValue(0x333333);
        }
            break;
        case kFontColorStyleGray:{
            self.mainFontColor = kCOLOR_RGBValue(0x333333);
        }
            break;
        default:
            break;
    }
    self.heavyFontColor = [self.mainFontColor colorWithAlphaComponent:0.9];
    self.nornalFontColor = [self.mainFontColor colorWithAlphaComponent:0.7];
    self.lightFontColor = [self.mainFontColor colorWithAlphaComponent:0.5];
}

- (UIFont *)mainFont:(CGFloat)size {
    switch (_fontStyle) {
        case kFontStyleSystem: {
            CGFloat scale =  [FrameManager shareInstance].scale;
            return [UIFont systemFontOfSize:size * scale];
        }
            break;
        case kFontStyleGillSans: {
            CGFloat scale =  [FrameManager shareInstance].scale;
            return [UIFont fontWithName:@"GillSans-Light" size:size * scale];
        }
            break;
        case kFontStyleHelveticaNeue: {
            CGFloat scale =  [FrameManager shareInstance].scale;
            return [UIFont fontWithName:@"HelveticaNeue-Light" size:size * scale];
        }
            break;
        default:
            break;
    }
    CGFloat scale =  [FrameManager shareInstance].scale;
    return [UIFont fontWithName:@"GillSans-Light" size:size * scale];
}

- (UIFont *)mainBoldFont:(CGFloat)size {
    switch (_fontStyle) {
        case kFontStyleSystem: {
            CGFloat scale =  [FrameManager shareInstance].scale;
            return [UIFont boldSystemFontOfSize:size * scale];
        }
            break;
        case kFontStyleGillSans: {
            CGFloat scale =  [FrameManager shareInstance].scale;
            return [UIFont fontWithName:@"GillSans-Bold" size:size * scale];
        }
            break;
        case kFontStyleHelveticaNeue: {
            CGFloat scale =  [FrameManager shareInstance].scale;
            return [UIFont fontWithName:@"HelveticaNeue-Bold" size:size * scale];
        }
            break;
        default:
            break;
    }
    CGFloat scale =  [FrameManager shareInstance].scale;
    return [UIFont fontWithName:@"GillSans-Bold" size:size * scale];
}

@end
